#include <bits/stdc++.h>
using namespace std;
namespace Raiden
{
const int N = 1002;
const int mod = 998244353;
int n, k, a[N];
int dp[N][N], ans;
int solve(const int x)
{
int u = 0;
dp[0][0] = 1;
for (int i = 1; i <= n; i++)
{
while (a[i] - a[u + 1] >= x)
u++;
dp[i][0] = 1;
for (int j = 1; j <= k; j++)
dp[i][j] = (dp[i - 1][j] + dp[u][j - 1]) % mod;
}
return dp[n][k];
}
signed work()
{
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i];
sort(a + 1, a + n + 1);
for (int i = 1; i * (k - 1) <= a[n]; i++)
ans = (ans + solve(i)) % mod;
cout << ans << endl;
return 0;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
return Raiden::work();
}
158A - Next Round | 71A - Way Too Long Words |
160A - Twins | 1A - Theatre Square |
1614B - Divan and a New Project | 791A - Bear and Big Brother |
1452A - Robot Program | 344A - Magnets |
96A - Football | 702B - Powers of Two |
1036A - Function Height | 443A - Anton and Letters |
1478B - Nezzar and Lucky Number | 228A - Is your horseshoe on the other hoof |
122A - Lucky Division | 1611C - Polycarp Recovers the Permutation |
432A - Choosing Teams | 758A - Holiday Of Equality |
1650C - Weight of the System of Nested Segments | 1097A - Gennady and a Card Game |
248A - Cupboards | 1641A - Great Sequence |
1537A - Arithmetic Array | 1370A - Maximum GCD |
149A - Business trip | 34A - Reconnaissance 2 |
59A - Word | 462B - Appleman and Card Game |
1560C - Infinity Table | 1605C - Dominant Character |